<?php

namespace app\admin\controller\other;

use app\common\controller\AdminController;
use app\common\service\RedisService;
use EasyAdmin\annotation\ControllerAnnotation;
use EasyAdmin\annotation\NodeAnotation;
use think\App;

/**
 * @ControllerAnnotation(title="协议")
 */
class Protocol extends AdminController
{

    use \app\admin\traits\Curd;

    public function __construct(App $app)
    {
        parent::__construct($app);

        $this->model = new \app\admin\model\OtherProtocol();
        
    }


    // 分别同步各项 协议
    public function sync(){
        $list = $this->model->select();
        foreach($list as &$item){
            // await redis.Client3.set(`${KEYS.PROTOCOL_LIST}${pid}`, JSON.stringify(data));
            RedisService::select(3)->set(self::KEYS['PROTOCOL_LIST']. $item->id , json_encode($item->content,JSON_UNESCAPED_UNICODE) );        //
        }
        $this->success("设置生效");
    }

}